#include<iostream>
using namespace std;
int min(int a,int b)
{
    if(a<b)return a;
        else return b;
}
int main(){
    int n,num;
    int a[5]={0,0,0,0,0};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>num;
        a[num]++;
    }
    int ans = 0;
    ans += a[4];
    num = min(a[1],a[3]);
    ans += num;
    a[1]-=num;
    a[3]-=num;
    ans+=a[3];
    a[2]=a[2]+a[1]/2;
    a[1]=a[1]%2;
    num = a[2]/2;
    ans+=num;
    a[2] =a[2]%2;
    if(a[1]+a[2]!=0) ans++;
    cout<<ans<<endl;
    return 0;
}
